package dm.ast.model.gen;

import dm.ast.DmASTNode;
import dm.ast.DmTop;
import test.utility.Randomly;

import java.util.Random;

public class TopGen extends ASTGenBase{

    @Override
    public DmASTNode gen(int astLevel, int wid_t, int dep_t) {
        DmTop top = new DmTop();
        Random r = new Random();

        top.setTargetWidt(wid_t);
        top.setTargetDept(dep_t);

        top.percentflag = Randomly.getBoolean();
        top.withTiesflag = Randomly.getBoolean();
        if(top.percentflag == false && top.withTiesflag == false){
            top.m = r.nextInt(1000);
            top.n = r.nextInt(1000);
        }else{
            top.m = r.nextInt(1000);
        }

        return top;
    }
}
